//
//  NSString+Custom.h
//  AFNetworking
//
//  Created by Huadong Zheng on 2023/4/11.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSString (Custom)
+(BOOL)isAvailableString:(NSString *)string;
/**
 返回一个可用的字符串
 
 @param string       原字符串
 @param defaultValue 默认字符串
 @return             有效的字符
 */
+(NSString *)getAvailableString:(NSString *)string defaultValue:(NSString *)defaultValue;

//去除左侧开始的指定字符
- (NSString *)stringByTrimmingLeftCharactersInSet:(NSCharacterSet *)characterSet;
//去除字符串尾端指定字符
- (NSString *)stringByTrimmingRightCharactersInSet:(NSCharacterSet *)characterSet;

//字符串逆序 v4.0
-(NSMutableString*)reverseString;


//由于一些字形由多个字符组成，这里可以把一个字形当成一个字符处理。就像用户的感知一样
-(NSString *) subStringFaceUserAtIndex:(NSInteger) index;
-(NSString *) subStringFaceUserFromRange:(NSRange) range;
-(NSInteger) lengthFaceUser;
+(NSMutableAttributedString *)stringWithArray:(NSArray<NSString *> *)strs color:(NSArray *)colors font:(NSArray *)fonts;
+(NSMutableAttributedString *)stringWithArray:(NSArray<NSString *> *)strs color:(NSArray *)colors font:(NSArray *)fonts expand:(NSDictionary<NSNumber *, NSDictionary *> *) expandDicts;
@end

NS_ASSUME_NONNULL_END
